#!/usr/bin/env python
# coding: utf-8
from os import system
import sys
import Image, ImageDraw, ImageFont

system('mkdir {0}'.format(sys.argv[1]))
system('mkdir {0}/caps'.format(sys.argv[1]))

letters = [u'א', u'ב', u'ג', u'ד', u'ה', u'ו', u'ז', u'ח', u'ט', u'י', u'ך', u'כ', u'ל', u'ם', u'מ', u'ן', u'נ', u'ס', u'ע', u'ף', u'פ', u'ץ', u'צ', u'ק', u'ר', u'ש', u'ת'] 

for (i, letter) in enumerate(letters):
    im = Image.new("RGB", (256, 256))
    d = ImageDraw.Draw(im)
    f = ImageFont.truetype('/home/moos/Downloads/ARIALUNI.TTF', 150)
    d.text((128- f.getsize(letter)[0]/2 - 1,128- f.getsize(letter)[1]/2 - 1), letter, font=f)
    im.save(open(u"{0}/{1}.png".format(sys.argv[1], letter), "wb"), "PNG")

print "Font written to directory {0}.".format(sys.argv[1])
